import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'

let imgState = {
    lunbo:[]
}
function reducer(state = imgState,action){
    if(action.type === 'LUNBO'){
        state.lunbo = action.lunbo
        // console.log(action)
        state.lunbo = action.data.map((item, key) => {
            return Object.assign({}, item, {key})
        })
        // console.log(111,state)
        // return {...state}
        return JSON.parse(JSON.stringify(state))
    }else{
        return state
    }
}

const store = createStore(reducer, applyMiddleware(thunk))
export default store